#pragma once

#define _USE_MATH_DEFINES
#include <string>
#include <vector>
#include <cmath>
#include "stringconverter.h"

/*
  Copyright 2008 by Alexey Solovyev and University of Pittsburgh
  Licensed under the Academic Free License version 3.0
  See the file "LICENSE" for more information
*/

namespace org
{
	namespace spark
	{
		namespace math
		{


			/// <summary>
			/// Basic implementation of a vector class
			/// </summary>
			class Vector 
			{
				/// <summary>
				/// Default serialVersionUID
				/// </summary>
			private:
				//static const long long serialVersionUID = 1LL;

			public:
				double x;
				double y;
				double z;
				//Vector(Vector v);

				Vector(double x, double y, double z);

				Vector(double v);

				//Vector(java::awt::Color *color);

				Vector();

				virtual Vector set_Renamed(Vector v);

				//virtual Vector set_Renamed(java::awt::Color *color);

				virtual Vector set_Renamed(double x, double y);

				virtual Vector set_Renamed(double x, double y, double z);

				virtual Vector set_Renamed(double v);

				virtual Vector add(Vector v);

				virtual Vector add(Vector v, double a);

				virtual Vector sub(Vector v);

				virtual Vector mul(double v);

				virtual Vector div(double v);

				virtual Vector negate();

				virtual double dot(Vector v);


				virtual Vector cross(Vector v);


				/// <summary>
				/// Return component of vector parallel to a unit
				/// basis vector (it is assumed to have unit length) </summary>
				/// <param name="unitBasis">
				/// @return </param>
				virtual Vector parallelComponent(Vector unitBasis);


				virtual Vector perpendicularComponent(Vector unitBasis);


				virtual double length();

				/// <summary>
				/// @deprecated
				/// @return
				/// </summary>
				virtual double norm2();

				virtual double lengthSquared();

				virtual Vector normalize();


				virtual Vector truncate(double min, double max);


				virtual Vector truncateDistance(double max);



				virtual Vector truncateLength(double max);


				virtual std::string ToString();

				//virtual java::awt::Color *toAWTColor();


				//virtual java::awt::Color *toAWTColorInt();


				static Vector getVector(double length, double dir);


				static Vector randomVector(double min, double max);


				static Vector randomVector2d(double min, double max);


				static Vector randomVector(double radius);


				static Vector randomVector2d(double radius);



				static Vector randomUnitVector();


				static Vector randomUnitVector2d();



				static Vector parseVector(const std::string &str);


				//static Vector fromAWTColor(java::awt::Color *color);


				static double distance(Vector v1, Vector v2);

				virtual bool Equals(Vector *v);
			};

		}
	}
}
